SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE   PROCEDURE [dbo].[wp_get_users]

AS

--Elimina registros obsoletos
DELETE wap_ingreso_sistema
WHERE DATEDIFF(day, getdate(), fe_ingreso) < 0

-- Selecciona los usuarios conectados
SELECT insis.cd_operador,
	oper.nm_operador,
	oper.nu_interno_telefono,
	insis.fe_ingreso,
	insis.nm_terminal
FROM wap_ingreso_sistema AS insis
INNER JOIN wad_operadores AS oper ON
	insis.cd_operador = oper.cd_operador


GO
